<div class="modal-dialog" role="document">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="exampleModalLabel">编辑轮播位</h4>
        </div>
        <form class="form-horizontal" style="margin:4%;" id="advpForm" data-toggle="validator">
            <input type="hidden"  name="advpId" value="{$advPlaceInfo.id}">
            <div class="form-group">
                <label for="recipient-name" class="control-label col-sm-3"><span style="color:red;">*</span>广告位名称:</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control" name="name" value="{$advPlaceInfo.name}" required>
                </div>
            </div>
            <div class="form-group">
                <label for="recipient-name" class="control-label col-sm-3"><span style="color:red;">*</span>位唯一标(英文):</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control" name="flag" value="{$advPlaceInfo.flag}"  pattern ="^\w+$" data-error="唯一标识为英文字母!" placeholder="请输入唯一标识(英文)" required>
                </div>
                <div class="help-block with-errors"></div>
            </div>
            <div class="form-group">
                <label for="recipient-name" class="control-label col-sm-3">内容描述:</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" name="introduce" value="{$advPlaceInfo.introduce}">
                </div>
            </div>
            <div class="form-group">
                <label for="recipient-name" class="control-label col-sm-3"><span style="color:red;">*</span>宽度限制:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" name="width" value="{$advPlaceInfo.width}" pattern ="^[0-9]+$" data-error="宽度只能为数字!" required>
                </div>
                <div class="help-block with-errors"></div>
            </div>
            <div class="form-group">
                <label for="recipient-name" class="control-label col-sm-3"><span style="color:red;">*</span>高度限制:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" name="height" value="{$advPlaceInfo.height}" data-error="高度只能为数字!" pattern ="^[0-9]+$" required>
                </div>
                <div class="help-block with-errors"></div>
            </div>
            <div class="form-group">
                <label for="message-text" class="control-label col-sm-3"><span style="color:red;">*</span>显示位置:</label>
                <div class="col-sm-3">
                    <!--<select name="prid" class="form-control">
                        <option>index</option>
                        <option>left</option>
                        <option>right</option>
                        <option>foot</option>
                    </select>-->
                    <input type="text" class="form-control " name="place" value="{$advPlaceInfo.place}" >
                </div>
            </div>
            <div class="form-group">
                <label for="message-text" class="control-label col-sm-3">优先级:</label>
                <!--<label class="control-label">Select - Basic</label>-->
                <div class="col-sm-2">
                    <!--<select name="position" class="form-control">
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
                    </select>-->
                    <input type="text" class="form-control " name="position" value="{$advPlaceInfo.position}" >
                </div>
            </div>
        </form>
        <div class="modal-footer">
            <button type="button" data-dismiss="modal" class="btn btn-default">取消</button>
            <button type="button" id="advPlaceSave" class="btn btn-primary">保存</button>
        </div>
    </div>
</div>
<script>
    $(function () {
        $('#advpForm').validator();
    })
    $("#advPlaceSave").click(function () {
        var validator = $("#advpForm").data("bs.validator");
        validator.validate();
        if(!validator.hasErrors()) {
            $.ajax({
                url: "{:U('Admin/Content/saveAdvPlace')}",
                type: "post",
                dataType: "json",
                data:$("#advpForm").serialize(),
                success: function (data) {
                    $("#commonModal").modal('toggle');
                    common.alert("提示","广告修改成功!",function(){
                        common.reload();
                    });

                }
            })
        }
    })
</script>